{extend name="common@base/common" /}

{block name="style"}
<link href="__CSS__/main.min.css" rel="stylesheet" type="text/css"/>
{/block}

{block name="body"}
<div class="container">
  <ol class="breadcrumb">
      <li><a href="{:url('index/index')}">演示首页</a></li>
      <li>数据表格</li>
  </ol>
<section class="demo-section">
<div id="pageContent">







<article><div class="alert alert-info">
  <h4>数据表格即将淘汰</h4>
  <p>数据表格即将淘汰，请使用全新的数据表格2，更多功能，<a class="alert-link" href="#view/datagrid">立即使用</a>。</p>
</div><p>数据表格插件是一个展示大量数据的强力工具。</p><div class="alert alert-warning">
  <h4>兼容性提示</h4>
  <ul>
    <li>在触摸屏上无法支持拖拽滚动功能；</li>
    <li>在小屏幕上无法获得最佳体验。</li>
  </ul>
</div><p>数据表格的主要思路是将一个表格的列在水平方向上分为三部分（以下称为称左侧列，中间列和右侧列），他们分别有如下特性：</p><ul>
<li>左侧列：所有左侧列的总宽度可以设置为表格的百分比或一个固定宽度，但设定后，不允许再次改变，左侧列中的所有列宽表现与普通表格一致，你可以单独设置某一列的宽度，其他列会自适应，推荐除了一个列宽设置为 auto，其他列都设置为固定列宽。</li>
<li>右侧列：右侧列的行为与中间列一致；</li>
<li>中间列：所有中间列的总宽度需要指定，最小值为表格宽度减去左侧列和右侧列宽度，超过最小值则允许水平滚动中间列（<strong>也就是说如果需要中间的所有列水平滚动则需要保证中间所有列的宽度总和超过中间区域宽度</strong>）。</li>
</ul></article>









<section><header><h3>简单应用</h3></header><article><h4>引入资源</h4><p>数据表格为独立组件，你需要从本地或 CDN 单独引入 lib 目录下的资源：</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;link</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"lib/datatable/zui.datatable.min.css"</span><span class="pln"> </span><span class="atn">rel</span><span class="pun">=</span><span class="atv">"stylesheet"</span><span class="tag">&gt;</span><span class="pln">
</span><span class="tag">&lt;script</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"lib/datatable/zui.datatable.min.js"</span><span class="tag">&gt;&lt;/script&gt;</span></code></pre><h4>例子</h4><p>在下面的例子中，表格左侧5列和右侧两列分别固定在两侧，其宽度不受外部容器宽度影响，中间位置的列则在宽度不够时会隐藏超出的部分，隐藏的列可以通过拖拽表头移动到可视区域，也可以使用下方的滚动条来调整隐藏的列显示区域。当向下滚动页面时，如果表头一旦处于不可见的位置时，则表头会调整样式而固定在页面顶端保持一直可见。</p><div class="example">
  <div class="datatable show-scroll-slide scrolled-out" id="datatable-fhc9ty7uij"><div class="datatable-head"><div class="datatable-head-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-left"><th class="datatable-head-cell text-center" data-index="0" data-type="number" style="width: 100px; min-height: 36px; height: 36px;">#</th><th class="datatable-head-cell sort-down" data-index="1" data-type="date" style="width: 160px; min-height: 36px; height: 36px;">时间</th><th class="datatable-head-cell" data-index="2" data-type="string" style="width: 80px; min-height: 36px; height: 36px;">房间</th><th class="datatable-head-cell" data-index="3" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">人物</th><th class="datatable-head-cell" data-index="4" data-type="string" style="width: auto; min-height: 36px; height: 36px;">事件</th></tr></thead></table></div></div><div class="datatable-head-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><thead><tr class="datatable-row datatable-row-flex"><th class="datatable-head-cell text-center" data-index="5" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">事件类型</th><th class="datatable-head-cell sort-disabled" data-index="6" data-type="string" style="width: 200px; min-height: 36px; height: 36px;">描述</th><th class="datatable-head-cell" data-index="7" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关人物</th><th class="datatable-head-cell" data-index="8" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关物品</th></tr></thead></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-head-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-right"><th class="datatable-head-cell text-center text-important" data-index="9" data-type="number" style="width: 60px; min-height: 36px; height: 36px;">评分</th><th class="datatable-head-cell sort-disabled" data-index="10" data-type="string" style="width: auto; min-height: 36px; height: 36px;">操作</th></tr></thead></table></div></div></div><div class="datatable-rows"><div class="datatable-rows-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row datatable-row-left" data-index="0" data-id="0"><td class="datatable-cell text-center" data-row="0" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 36px; height: 36px;">101010</td><td class="datatable-cell" data-row="0" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 36px; height: 36px;">2019-10-29 11:33:10</td><td class="datatable-cell" data-row="0" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 36px; height: 36px;">Z018</td><td class="datatable-cell" data-row="0" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">Catouse</td><td class="datatable-cell" data-row="0" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;">交谈</td></tr><tr class="datatable-row datatable-row-left" data-index="1" data-id="1"><td class="datatable-cell text-center" data-row="1" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101011</td><td class="datatable-cell" data-row="1" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 11:17:14</td><td class="datatable-cell" data-row="1" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B340</td><td class="datatable-cell" data-row="1" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="1" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">捶打墙壁</td></tr><tr class="datatable-row datatable-row-left" data-index="2" data-id="2"><td class="datatable-cell text-center" data-row="2" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101012</td><td class="datatable-cell" data-row="2" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 10:23:25</td><td class="datatable-cell" data-row="2" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A010</td><td class="datatable-cell" data-row="2" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">奥特曼</td><td class="datatable-cell" data-row="2" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">喝水</td></tr><tr class="datatable-row datatable-row-left" data-index="3" data-id="3"><td class="datatable-cell text-center" data-row="3" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101013</td><td class="datatable-cell" data-row="3" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 10:06:59</td><td class="datatable-cell" data-row="3" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A004</td><td class="datatable-cell" data-row="3" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="3" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">唱歌</td></tr><tr class="datatable-row datatable-row-left" data-index="4" data-id="4"><td class="datatable-cell text-center" data-row="4" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101014</td><td class="datatable-cell" data-row="4" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 09:19:21</td><td class="datatable-cell" data-row="4" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B340</td><td class="datatable-cell" data-row="4" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">奥特曼</td><td class="datatable-cell" data-row="4" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">搬动椅子</td></tr></tbody></table></div></div><div class="datatable-rows-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><tbody><tr class="datatable-row datatable-row-flex" data-index="0" data-id="0"><td class="datatable-cell text-center" data-row="0" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">:]</td><td class="datatable-cell" data-row="0" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 36px; height: 36px;">这次失败了</td><td class="datatable-cell" data-row="0" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">奥特曼</td><td class="datatable-cell" data-row="0" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">椅子</td></tr><tr class="datatable-row datatable-row-flex" data-index="1" data-id="1"><td class="datatable-cell text-center" data-row="1" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="1" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">徒劳</td><td class="datatable-cell" data-row="1" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">奥特曼</td><td class="datatable-cell" data-row="1" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">水杯</td></tr><tr class="datatable-row datatable-row-flex" data-index="2" data-id="2"><td class="datatable-cell text-center" data-row="2" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="2" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">情况不明</td><td class="datatable-cell" data-row="2" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">路人丙</td><td class="datatable-cell" data-row="2" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">随从</td></tr><tr class="datatable-row datatable-row-flex" data-index="3" data-id="3"><td class="datatable-cell text-center" data-row="3" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">happy</td><td class="datatable-cell" data-row="3" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">禁止再次发生</td><td class="datatable-cell" data-row="3" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">奥特曼</td><td class="datatable-cell" data-row="3" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">随从</td></tr><tr class="datatable-row datatable-row-flex" data-index="4" data-id="4"><td class="datatable-cell text-center" data-row="4" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="4" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">徒劳</td><td class="datatable-cell" data-row="4" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="4" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">椅子</td></tr></tbody></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-rows-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row datatable-row-right" data-index="0" data-id="0"><td class="datatable-cell text-center text-important" data-row="0" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 36px; height: 36px;">9.1</td><td class="datatable-cell" data-row="0" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="1" data-id="1"><td class="datatable-cell text-center text-important" data-row="1" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">8.5</td><td class="datatable-cell" data-row="1" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="2" data-id="2"><td class="datatable-cell text-center text-important" data-row="2" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">6</td><td class="datatable-cell" data-row="2" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="3" data-id="3"><td class="datatable-cell text-center text-important" data-row="3" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">6.2</td><td class="datatable-cell" data-row="3" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="4" data-id="4"><td class="datatable-cell text-center text-important" data-row="4" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">7.8</td><td class="datatable-cell" data-row="4" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr></tbody></table></div></div></div><div class="scroll-wrapper"><div class="scroll-slide scroll-pos-in" style="width: 264px; left: 632px;"><div class="bar" style="left: 0px; width: 137px;"></div></div></div></div>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="com">&lt;!-- HTML 代码 --&gt;</span><span class="pln">
</span><span class="tag">&lt;table</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"table datatable"</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;thead&gt;</span><span class="pln">
    </span><span class="tag">&lt;tr&gt;</span><span class="pln">
      </span><span class="com">&lt;!-- 以下两列左侧固定 --&gt;</span><span class="pln">
      </span><span class="tag">&lt;th&gt;</span><span class="pln">#</span><span class="tag">&lt;/th&gt;</span><span class="pln">
      </span><span class="tag">&lt;th&gt;</span><span class="pln">时间</span><span class="tag">&lt;/th&gt;</span><span class="pln">

      </span><span class="com">&lt;!-- 以下三列中间可滚动 --&gt;</span><span class="pln">
      </span><span class="tag">&lt;th</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"flex-col"</span><span class="pln"> </span><span class="atn">data-width</span><span class="pun">=</span><span class="atv">"100"</span><span class="tag">&gt;</span><span class="pln">事件类型</span><span class="tag">&lt;/th&gt;</span><span class="pln"> 
      </span><span class="tag">&lt;th</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"flex-col"</span><span class="pln"> </span><span class="atn">data-width</span><span class="pun">=</span><span class="atv">"200"</span><span class="tag">&gt;</span><span class="pln">描述</span><span class="tag">&lt;/th&gt;</span><span class="pln">
      </span><span class="tag">&lt;th</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"flex-col"</span><span class="pln"> </span><span class="atn">data-width</span><span class="pun">=</span><span class="atv">"300"</span><span class="tag">&gt;</span><span class="pln">相关人物</span><span class="tag">&lt;/th&gt;</span><span class="pln">

      </span><span class="com">&lt;!-- 以下列右侧固定 --&gt;</span><span class="pln">
      </span><span class="tag">&lt;th&gt;</span><span class="pln">评分</span><span class="tag">&lt;/th&gt;</span><span class="pln">
      ...
    </span><span class="tag">&lt;/tr&gt;</span><span class="pln">
  </span><span class="tag">&lt;/thead&gt;</span><span class="pln">
  </span><span class="tag">&lt;tbody&gt;</span><span class="pln">
    </span><span class="tag">&lt;tr&gt;</span><span class="pln">...</span><span class="tag">&lt;/tr&gt;</span><span class="pln">
    </span><span class="tag">&lt;tr&gt;</span><span class="pln">...</span><span class="tag">&lt;/tr&gt;</span><span class="pln">
    ...
  </span><span class="tag">&lt;/tbody&gt;</span><span class="pln">
</span><span class="tag">&lt;/table&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">/* 初始化数据表格 */</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">();</span></code></pre></article></section>




<section><header><h3>启用排序功能</h3></header><article><p>只需要更改一个参数即可启用数据排序功能。DataTable支持对数字、日期或字符串进行升序和降序排序。</p><div class="example">
  <div class="datatable sortable show-scroll-slide scrolled-out" data-sortable="true" id="datatable-fhc9ty96cs"><div class="datatable-head"><div class="datatable-head-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-left"><th class="datatable-head-cell text-center" data-index="0" data-type="number" style="width: 100px; min-height: 36px; height: 36px;">#</th><th class="datatable-head-cell sort-up" data-index="1" data-type="date" style="width: 160px; min-height: 36px; height: 36px;">时间</th><th class="datatable-head-cell" data-index="2" data-type="string" style="width: 80px; min-height: 36px; height: 36px;">房间</th><th class="datatable-head-cell" data-index="3" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">人物</th><th class="datatable-head-cell" data-index="4" data-type="string" style="width: auto; min-height: 36px; height: 36px;">事件</th></tr></thead></table></div></div><div class="datatable-head-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><thead><tr class="datatable-row datatable-row-flex"><th class="datatable-head-cell text-center" data-index="5" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">事件类型</th><th class="datatable-head-cell sort-disabled" data-index="6" data-type="string" style="width: 200px; min-height: 36px; height: 36px;">描述</th><th class="datatable-head-cell" data-index="7" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关人物</th><th class="datatable-head-cell" data-index="8" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关物品</th></tr></thead></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-head-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-right"><th class="datatable-head-cell text-center text-important" data-index="9" data-type="number" style="width: 60px; min-height: 36px; height: 36px;">评分</th><th class="datatable-head-cell sort-disabled" data-index="10" data-type="string" style="width: auto; min-height: 36px; height: 36px;">操作</th></tr></thead></table></div></div></div><div class="datatable-rows"><div class="datatable-rows-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row datatable-row-left" data-index="4" data-id="4"><td class="datatable-cell text-center" data-row="4" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 36px; height: 36px;">101014</td><td class="datatable-cell" data-row="4" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 36px; height: 36px;">2019-10-29 07:13:33</td><td class="datatable-cell" data-row="4" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 36px; height: 36px;">Z431</td><td class="datatable-cell" data-row="4" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">行者孙</td><td class="datatable-cell" data-row="4" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;">自言自语</td></tr><tr class="datatable-row datatable-row-left" data-index="3" data-id="3"><td class="datatable-cell text-center" data-row="3" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101013</td><td class="datatable-cell" data-row="3" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 07:44:46</td><td class="datatable-cell" data-row="3" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B008</td><td class="datatable-cell" data-row="3" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">地卜师</td><td class="datatable-cell" data-row="3" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">唱歌</td></tr><tr class="datatable-row datatable-row-left" data-index="2" data-id="2"><td class="datatable-cell text-center" data-row="2" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101012</td><td class="datatable-cell" data-row="2" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 08:21:38</td><td class="datatable-cell" data-row="2" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A003</td><td class="datatable-cell" data-row="2" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="2" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">唱歌</td></tr><tr class="datatable-row datatable-row-left" data-index="1" data-id="1"><td class="datatable-cell text-center" data-row="1" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101011</td><td class="datatable-cell" data-row="1" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 08:27:32</td><td class="datatable-cell" data-row="1" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A004</td><td class="datatable-cell" data-row="1" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">地卜师</td><td class="datatable-cell" data-row="1" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">交谈</td></tr><tr class="datatable-row datatable-row-left" data-index="0" data-id="0"><td class="datatable-cell text-center" data-row="0" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101010</td><td class="datatable-cell" data-row="0" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 08:37:41</td><td class="datatable-cell" data-row="0" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A143</td><td class="datatable-cell" data-row="0" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">奥特曼</td><td class="datatable-cell" data-row="0" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">上网</td></tr></tbody></table></div></div><div class="datatable-rows-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><tbody><tr class="datatable-row datatable-row-flex" data-index="4" data-id="4"><td class="datatable-cell text-center" data-row="4" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">happy</td><td class="datatable-cell" data-row="4" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 36px; height: 36px;">情况不明</td><td class="datatable-cell" data-row="4" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">路人丙</td><td class="datatable-cell" data-row="4" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">水杯</td></tr><tr class="datatable-row datatable-row-flex" data-index="3" data-id="3"><td class="datatable-cell text-center" data-row="3" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">happy</td><td class="datatable-cell" data-row="3" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">发现未知征兆</td><td class="datatable-cell" data-row="3" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="3" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">随从</td></tr><tr class="datatable-row datatable-row-flex" data-index="2" data-id="2"><td class="datatable-cell text-center" data-row="2" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">sad</td><td class="datatable-cell" data-row="2" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">发现未知征兆</td><td class="datatable-cell" data-row="2" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">地卜师</td><td class="datatable-cell" data-row="2" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">随从</td></tr><tr class="datatable-row datatable-row-flex" data-index="1" data-id="1"><td class="datatable-cell text-center" data-row="1" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="1" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">徒劳</td><td class="datatable-cell" data-row="1" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="1" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">椅子</td></tr><tr class="datatable-row datatable-row-flex" data-index="0" data-id="0"><td class="datatable-cell text-center" data-row="0" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">sad</td><td class="datatable-cell" data-row="0" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">没有完成</td><td class="datatable-cell" data-row="0" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="0" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">水杯</td></tr></tbody></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-rows-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row datatable-row-right" data-index="4" data-id="4"><td class="datatable-cell text-center text-important" data-row="4" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 36px; height: 36px;">8.2</td><td class="datatable-cell" data-row="4" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="3" data-id="3"><td class="datatable-cell text-center text-important" data-row="3" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">8.5</td><td class="datatable-cell" data-row="3" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="2" data-id="2"><td class="datatable-cell text-center text-important" data-row="2" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">5.2</td><td class="datatable-cell" data-row="2" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="1" data-id="1"><td class="datatable-cell text-center text-important" data-row="1" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">8</td><td class="datatable-cell" data-row="1" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="0" data-id="0"><td class="datatable-cell text-center text-important" data-row="0" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">0.6</td><td class="datatable-cell" data-row="0" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr></tbody></table></div></div></div><div class="scroll-wrapper"><div class="scroll-slide scroll-pos-in" style="width: 264px; left: 632px;"><div class="bar" style="left: 0px; width: 137px;"></div></div></div></div>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">({</span><span class="pln">sortable</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">});</span></code></pre></article></section>



<section><header><h3>高亮选中行</h3></header><article><div class="example">
  <div class="datatable show-scroll-slide scrolled-out" data-checkable="true" id="datatable-fhc9tyajql"><div class="datatable-head"><div class="datatable-head-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-left"><th data-index="check" class="check-all check-btn"><i class="icon-check-empty"></i></th><th class="datatable-head-cell text-center" data-index="0" data-type="number" style="width: 100px; min-height: 36px; height: 36px;">#</th><th class="datatable-head-cell sort-down" data-index="1" data-type="date" style="width: 160px; min-height: 36px; height: 36px;">时间</th><th class="datatable-head-cell" data-index="2" data-type="string" style="width: 80px; min-height: 36px; height: 36px;">房间</th><th class="datatable-head-cell" data-index="3" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">人物</th><th class="datatable-head-cell" data-index="4" data-type="string" style="width: auto; min-height: 36px; height: 36px;">事件</th></tr></thead></table></div></div><div class="datatable-head-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><thead><tr class="datatable-row datatable-row-flex"><th class="datatable-head-cell text-center" data-index="5" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">事件类型</th><th class="datatable-head-cell sort-disabled" data-index="6" data-type="string" style="width: 200px; min-height: 36px; height: 36px;">描述</th><th class="datatable-head-cell" data-index="7" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关人物</th><th class="datatable-head-cell" data-index="8" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关物品</th></tr></thead></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-head-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-right"><th class="datatable-head-cell text-center text-important" data-index="9" data-type="number" style="width: 60px; min-height: 36px; height: 36px;">评分</th><th class="datatable-head-cell sort-disabled" data-index="10" data-type="string" style="width: auto; min-height: 36px; height: 36px;">操作</th></tr></thead></table></div></div></div><div class="datatable-rows"><div class="datatable-rows-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row datatable-row-left" data-index="0" data-id="0"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="0" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 36px; height: 36px;">101010</td><td class="datatable-cell" data-row="0" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 36px; height: 36px;">2019-10-29 06:46:16</td><td class="datatable-cell" data-row="0" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 36px; height: 36px;">Z864</td><td class="datatable-cell" data-row="0" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">行者孙</td><td class="datatable-cell" data-row="0" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;">睡觉</td></tr><tr class="datatable-row datatable-row-left" data-index="1" data-id="1"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="1" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101011</td><td class="datatable-cell" data-row="1" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 06:40:59</td><td class="datatable-cell" data-row="1" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">Z000</td><td class="datatable-cell" data-row="1" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">行者孙</td><td class="datatable-cell" data-row="1" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">上网</td></tr><tr class="datatable-row datatable-row-left" data-index="2" data-id="2"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="2" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101012</td><td class="datatable-cell" data-row="2" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 06:29:33</td><td class="datatable-cell" data-row="2" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A143</td><td class="datatable-cell" data-row="2" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">行者孙</td><td class="datatable-cell" data-row="2" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">梦游</td></tr><tr class="datatable-row datatable-row-left" data-index="3" data-id="3"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="3" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101013</td><td class="datatable-cell" data-row="3" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 05:38:58</td><td class="datatable-cell" data-row="3" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B098</td><td class="datatable-cell" data-row="3" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">地卜师</td><td class="datatable-cell" data-row="3" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">上网</td></tr><tr class="datatable-row datatable-row-left" data-index="4" data-id="4"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="4" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101014</td><td class="datatable-cell" data-row="4" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 04:46:05</td><td class="datatable-cell" data-row="4" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">Z864</td><td class="datatable-cell" data-row="4" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="4" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">上网</td></tr></tbody></table></div></div><div class="datatable-rows-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><tbody><tr class="datatable-row datatable-row-flex" data-index="0" data-id="0"><td class="datatable-cell text-center" data-row="0" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">sad</td><td class="datatable-cell" data-row="0" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 36px; height: 36px;">没有完成</td><td class="datatable-cell" data-row="0" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">路人丙</td><td class="datatable-cell" data-row="0" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">桌子</td></tr><tr class="datatable-row datatable-row-flex" data-index="1" data-id="1"><td class="datatable-cell text-center" data-row="1" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">sad</td><td class="datatable-cell" data-row="1" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">情况不明</td><td class="datatable-cell" data-row="1" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="1" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">枪</td></tr><tr class="datatable-row datatable-row-flex" data-index="2" data-id="2"><td class="datatable-cell text-center" data-row="2" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">happy</td><td class="datatable-cell" data-row="2" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">没有完成</td><td class="datatable-cell" data-row="2" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">路人丙</td><td class="datatable-cell" data-row="2" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">水杯</td></tr><tr class="datatable-row datatable-row-flex" data-index="3" data-id="3"><td class="datatable-cell text-center" data-row="3" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="3" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">徒劳</td><td class="datatable-cell" data-row="3" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="3" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">枪</td></tr><tr class="datatable-row datatable-row-flex" data-index="4" data-id="4"><td class="datatable-cell text-center" data-row="4" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="4" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">很满意</td><td class="datatable-cell" data-row="4" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="4" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">桌子</td></tr></tbody></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-rows-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row datatable-row-right" data-index="0" data-id="0"><td class="datatable-cell text-center text-important" data-row="0" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 36px; height: 36px;">2.9</td><td class="datatable-cell" data-row="0" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="1" data-id="1"><td class="datatable-cell text-center text-important" data-row="1" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">7.6</td><td class="datatable-cell" data-row="1" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="2" data-id="2"><td class="datatable-cell text-center text-important" data-row="2" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">5.2</td><td class="datatable-cell" data-row="2" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="3" data-id="3"><td class="datatable-cell text-center text-important" data-row="3" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">4.2</td><td class="datatable-cell" data-row="3" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="4" data-id="4"><td class="datatable-cell text-center text-important" data-row="4" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">9.8</td><td class="datatable-cell" data-row="4" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr></tbody></table></div></div></div><div class="scroll-wrapper"><div class="scroll-slide scroll-pos-in" style="width: 264px; left: 632px;"><div class="bar" style="left: 0px; width: 137px;"></div></div></div></div>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">({</span><span class="pln">checkable</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">});</span></code></pre></article></section>




<section><header><h3>综合示例</h3></header><article><p>你可以启用所有增强选项。</p><div class="example">
  <div class="datatable sortable show-scroll-slide scrolled-out" data-checkable="true" data-sortable="true" id="datatable-fhc9tybrpz"><div class="datatable-head"><div class="datatable-head-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-left"><th data-index="check" class="check-all check-btn"><i class="icon-check-empty"></i></th><th class="datatable-head-cell text-center" data-index="0" data-type="number" style="width: 100px; min-height: 36px; height: 36px;">#</th><th class="datatable-head-cell sort-up" data-index="1" data-type="date" style="width: 160px; min-height: 36px; height: 36px;">时间</th><th class="datatable-head-cell" data-index="2" data-type="string" style="width: 80px; min-height: 36px; height: 36px;">房间</th><th class="datatable-head-cell" data-index="3" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">人物</th><th class="datatable-head-cell" data-index="4" data-type="string" style="width: auto; min-height: 36px; height: 36px;">事件</th></tr></thead></table></div></div><div class="datatable-head-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><thead><tr class="datatable-row datatable-row-flex"><th class="datatable-head-cell text-center" data-index="5" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">事件类型</th><th class="datatable-head-cell sort-disabled" data-index="6" data-type="string" style="width: 200px; min-height: 36px; height: 36px;">描述</th><th class="datatable-head-cell" data-index="7" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关人物</th><th class="datatable-head-cell" data-index="8" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关物品</th></tr></thead></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-head-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-right"><th class="datatable-head-cell text-center text-important" data-index="9" data-type="number" style="width: 60px; min-height: 36px; height: 36px;">评分</th><th class="datatable-head-cell sort-disabled" data-index="10" data-type="string" style="width: auto; min-height: 36px; height: 36px;">操作</th></tr></thead></table></div></div></div><div class="datatable-rows"><div class="datatable-rows-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row active datatable-row-left" data-index="4" data-id="4"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="4" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 36px; height: 36px;">101014</td><td class="datatable-cell" data-row="4" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 36px; height: 36px;">2019-10-29 02:00:51</td><td class="datatable-cell" data-row="4" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 36px; height: 36px;">Z000</td><td class="datatable-cell" data-row="4" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">行者孙</td><td class="datatable-cell" data-row="4" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;">上网</td></tr><tr class="datatable-row datatable-row-left" data-index="3" data-id="3"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="3" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101013</td><td class="datatable-cell" data-row="3" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 02:30:39</td><td class="datatable-cell" data-row="3" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A003</td><td class="datatable-cell" data-row="3" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">奥特曼</td><td class="datatable-cell" data-row="3" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">唱歌</td></tr><tr class="datatable-row datatable-row-left" data-index="2" data-id="2"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="2" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101012</td><td class="datatable-cell" data-row="2" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 03:08:06</td><td class="datatable-cell" data-row="2" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B487</td><td class="datatable-cell" data-row="2" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">行者孙</td><td class="datatable-cell" data-row="2" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">自言自语</td></tr><tr class="datatable-row datatable-row-left" data-index="1" data-id="1"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="1" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101011</td><td class="datatable-cell" data-row="1" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 03:34:02</td><td class="datatable-cell" data-row="1" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">A143</td><td class="datatable-cell" data-row="1" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="1" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">唱歌</td></tr><tr class="datatable-row datatable-row-left" data-index="0" data-id="0"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="0" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101010</td><td class="datatable-cell" data-row="0" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 03:58:00</td><td class="datatable-cell" data-row="0" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">Z018</td><td class="datatable-cell" data-row="0" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="0" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">交谈</td></tr></tbody></table></div></div><div class="datatable-rows-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><tbody><tr class="datatable-row active datatable-row-flex" data-index="4" data-id="4"><td class="datatable-cell text-center" data-row="4" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">happy</td><td class="datatable-cell" data-row="4" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 36px; height: 36px;">情况不明</td><td class="datatable-cell" data-row="4" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">行者孙</td><td class="datatable-cell" data-row="4" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">椅子</td></tr><tr class="datatable-row datatable-row-flex" data-index="3" data-id="3"><td class="datatable-cell text-center" data-row="3" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">sad</td><td class="datatable-cell" data-row="3" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">发现未知征兆</td><td class="datatable-cell" data-row="3" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">路人丙</td><td class="datatable-cell" data-row="3" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">水杯</td></tr><tr class="datatable-row datatable-row-flex" data-index="2" data-id="2"><td class="datatable-cell text-center" data-row="2" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="2" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">禁止再次发生</td><td class="datatable-cell" data-row="2" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="2" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">桌子</td></tr><tr class="datatable-row datatable-row-flex" data-index="1" data-id="1"><td class="datatable-cell text-center" data-row="1" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="1" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">这次失败了</td><td class="datatable-cell" data-row="1" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="1" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">水杯</td></tr><tr class="datatable-row datatable-row-flex" data-index="0" data-id="0"><td class="datatable-cell text-center" data-row="0" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="0" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">这次失败了</td><td class="datatable-cell" data-row="0" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">地卜师</td><td class="datatable-cell" data-row="0" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">枪</td></tr></tbody></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-rows-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row active datatable-row-right" data-index="4" data-id="4"><td class="datatable-cell text-center text-important" data-row="4" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 36px; height: 36px;">9.7</td><td class="datatable-cell" data-row="4" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="3" data-id="3"><td class="datatable-cell text-center text-important" data-row="3" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">9.7</td><td class="datatable-cell" data-row="3" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="2" data-id="2"><td class="datatable-cell text-center text-important" data-row="2" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">3.6</td><td class="datatable-cell" data-row="2" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="1" data-id="1"><td class="datatable-cell text-center text-important" data-row="1" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">3.8</td><td class="datatable-cell" data-row="1" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="0" data-id="0"><td class="datatable-cell text-center text-important" data-row="0" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">8.7</td><td class="datatable-cell" data-row="0" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr></tbody></table></div></div></div><div class="scroll-wrapper"><div class="scroll-slide scroll-pos-in" style="width: 264px; left: 632px;"><div class="bar" style="left: 0px; width: 137px;"></div></div></div></div>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">({</span><span class="pln">checkable</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"> sortable</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">});</span></code></pre></article></section>




<section><header><h3>选项</h3></header><article><div class="table-responsive"><table class="table-bordered table">
  <thead>
    <tr><th>参数</th>
    <th>可选值</th>
    <th>说明</th>
  </tr></thead>
  <tbody>
    <tr>
      <td><code>checkable</code></td>
      <td><em>   <code>false</code> (默认)
</em>   <code>true</code></td>
      <td>是否启用行选中状态维护，启用后将在列首显示多选按钮</td>
    </tr>
    <tr>
      <td><code>checkByClickRow</code></td>
      <td><em>   <code>false</code>
</em>   <code>true</code> (默认)</td>
      <td>是否点击行的任意位置来切换选中状态

仅在<code>checkable</code>选项为<code>true</code>时生效</td>
    </tr>
    <tr>
      <td><code>checkedClass</code></td>
      <td>字符串，默认为<code>"active"</code></td>
      <td></td></tr><tr></tr>
    
    <tr>
      <td><code>storage</code></td>
      <td><em>   <code>false</code>
</em>   <code>true</code> (默认)</td>
      <td>是否启用本地存储来增强用户体验。启用该选项之后，表格排序状态及选中的行在用户刷新页面之后仍然会还原为之前的状态。</td>
    </tr>
    <tr>
      <td><code>sortable</code></td>
      <td><em>   <code>false</code> (默认)
</em>   <code>true</code></td>
      <td>是否启用表格排序，点击表头能够以该列来为数据排序</td>
    </tr>
    <tr>
      <td><code>fixedHeader</code></td>
      <td><em>   <code>false</code> (默认)
</em>   <code>true</code></td>
      <td>是否固定表格头部，如果启用当页面滚动到下方导致表头不可见时重新定位表头到页面顶部保持可见。<span class="text-warning">固定头部是相对页面 <code>&lt;body&gt;</code> 元素，如果数据表格已经在一个已被固定的元素中，此功能可能无法生效。</span></td>
    </tr>
    <tr>
      <td><code>fixedHeaderOffset</code></td>
      <td>数字，默认值为<code>0</code></td>
      <td>当标题固定时距离顶部的高度，当页面顶部包含其他固定的内容时需要调整该值

仅在<code>fixedHeader</code>选项为<code>true</code>时生效</td>
    </tr>
    <tr>
      <td><code>fixedLeftWidth</code></td>
      <td>数字或者表示百分比的字符串，默认值为<code>"30%"</code></td>
      <td>左侧固定的所有列的宽度，可以指定为百分比</td>
    </tr>
    <tr>
      <td><code>fixedRightWidth</code></td>
      <td>数字或者表示百分比的字符串，默认值为<code>"30%"</code></td>
      <td>右侧固定的所有列的宽度，可以指定为百分比</td>
    </tr>
    <tr>
      <td><code>flexHeadDrag</code></td>
      <td><em>   <code>false</code>
</em>   <code>true</code> (默认)</td>
      <td>是否能够通告拖拽可变区域的头部来调整可见区域</td>
    </tr>
    <tr>
      <td><code>scrollPos</code></td>
      <td><em>   <code>'in'</code> (默认)
</em>   <code>'out'</code></td>
      <td>滚动条位置</td>
    </tr>
    <tr>
      <td><code>rowHover</code></td>
      <td><em>   <code>false</code>
</em>   <code>true</code> (默认)</td>
      <td>是否在行上启用鼠标悬停样式</td>
    </tr>
    <tr>
      <td><code>colHover</code></td>
      <td><em>   <code>false</code>
</em>   <code>true</code> (默认)</td>
      <td>是否在列上启用鼠标悬停样式，仅当鼠标悬停表头时生效</td>
    </tr>
<!--       <tr>
      <td><code>customizable</code></td>
      <td>
        <ul>
          <li><code>false</code> (默认)</li>
          <li><code>true</code></li>
        </ul>
      </td>
      <td>是否能够通过拖拽表头边缘来更改列宽</td>
    </tr> -->
    <tr>
      <td><code>fixCellHeight</code></td>
      <td><code>true</code>（默认），<code>false</code></td>
      <td>是否在渲染之后自动调整单元格行高，因为数据表格将列分成多个部分，可能存在同一行上的行高不一致，开启该选项可以自动进行调整，关闭此选项可以提高表格渲染效率（关闭后仍然可以使用 CSS 来限制行高）。</td>
    </tr>
    <tr>
      <td><code>minColWidth</code></td>
      <td>数字，默认为<code>20</code></td>
      <td>列的最小宽度</td>
    </tr>
    <tr>
      <td><code>minFixedLeftWidth</code></td>
      <td>数字，默认为<code>200</code></td>
      <td>左侧所有固定列的最小宽度</td>
    </tr>
    <tr>
      <td><code>minFixedRightWidth</code></td>
      <td>数字，默认为<code>200</code></td>
      <td>右侧所有固定列的最小宽度</td>
    </tr>
    <tr>
      <td><code>minFlexAreaWidth</code></td>
      <td>数字，默认为<code>200</code></td>
      <td>中间可变区域最小宽度</td>
    </tr>
    <tr>
      <td><code>selectable</code></td>
      <td><code>true</code>（默认），<code>false</code>，<code>{...}</code></td>
      <td>是否启用 <a href="#javascript/selectable">拖拽选取</a> 功能，如果启用则可以直接将该选项的值设置为拖拽选取插件所支持的选项。</td>
    </tr>
  </tbody>
</table></div><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">({</span><span class="pln">
    checkable</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln">
    sortable</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln">
    checkedClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">"checked"</span><span class="pun">,</span><span class="pln">
    minFixedLeftWidth</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300</span><span class="pln">
    </span><span class="com">// 更多参数...</span><span class="pln">
</span><span class="pun">});</span></code></pre><p>选项也可以直接使用<code>data-*</code>属性写在要增强的HTML标签上。</p></article></section>







<section><header><h3>事件</h3></header><article><p>Datatable中的事件既可以使用jQuery原生方法来绑定，也可以写在选项中。</p><div class="table-responsive"><table class="table table-bordered">
  <thead>
    <tr>
      <th>事件名称</th>
      <th>jQuery事件名称</th>
      <th>说明</th>
      <th>事件参数</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>afterLoad</code></td>
      <td><code>"afterLoad.zui.datatable"</code></td>
      <td>数据加载完毕后调用</td>
      <td><em>   <code>event.data</code> 表格数据</em></td>
    </tr>
    <tr>
      <td><code>ready</code></td>
      <td><code>"ready.zui.datatable"</code></td>
      <td>渲染完毕后调用，可以在此事件中为DOM绑定其他事件</td>
      <td>无</td>
    </tr>
    <tr>
      <td><code>sort</code></td>
      <td><code>"sort.zui.datatable"</code></td>
      <td>表格重新排序之后</td>
      <td>   <code>event.sorter.index</code> 数字，排序所依据的列序号
<em>   <code>event.sorter.sortUp</code> 排序方向，<code>true</code>为升序，<code>false</code> 为降序</em></td>
    </tr>
    <tr>
      <td><code>sizeChanged</code></td>
      <td><code>"sizeChanged.zui.datatable"</code></td>
      <td>列宽发生更改时发生</td>
      <td>   <code>event.changes.change</code> 字符串，变化的类型，<code>"fixedLeftWidth"</code> 为左侧所有固定列总宽度发生变化，<code>"fixedRightWidth"</code> 为右侧所有固定列总宽度发生变化，<code>"colWidth"</code> 为单个列宽度发生变化
<em>   <code>event.changes.oldWidth</code> 数字，发生变化之前的宽度值
</em>   <code>event.changes.newWidth</code> 数字，新的宽度值
<em>   <code>event.changes.colIndex</code> 数字，如果是单个列宽发生变化，则该值指示发生变化列的序号</em></td>
    </tr>
    <tr>
      <td><code>checksChanged</code></td>
      <td><code>"checksChanged.zui.datatable"</code></td>
      <td>当行的选中状态发生变化时发生</td>
      <td>   <code>event.checks.checkedAll</code> 如果为<code>true</code> 标识当前所有行都被选中，反之则表示至少有一行为被选中
*   <code>event.checks.checks</code> 数字数组，包含所有已选中的行的ID</td>
    </tr>
  </tbody>
</table></div><h5>使用选项处理事件</h5><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">({</span><span class="pln">
    sort</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">event</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">event</span><span class="pun">);</span><span class="pln">
        </span><span class="com">// console.log("表格已重新排序！");</span><span class="pln">
        </span><span class="com">// 处理 sort 事件</span><span class="pln">
        </span><span class="com">// ...</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">});</span></code></pre><h5>使用jQuery方法绑定事件处理函数</h5><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">().</span><span class="pln">on</span><span class="pun">(</span><span class="str">"sort.zui.datatable"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">event</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">event</span><span class="pun">);</span><span class="pln">
    </span><span class="com">// console.log("表格已重新排序！");</span><span class="pln">
    </span><span class="com">// 处理 sort 事件</span><span class="pln">
    </span><span class="com">// ...</span><span class="pln">
</span><span class="pun">});</span></code></pre></article></section>




<section><header><h3>属性</h3></header><article><p>当 <code>checkable</code> 选项被启用时可以使用数据表格实例上的 <code>checks</code> 属性来获取当前已选择行的状态。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 获取数据表格实例对象</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> myDatatable </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">data</span><span class="pun">(</span><span class="str">'zui.datatable'</span><span class="pun">);</span><span class="pln">

</span><span class="com">// 获取行选中数据</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> checksStatus </span><span class="pun">=</span><span class="pln"> myDatatable</span><span class="pun">.</span><span class="pln">checks</span><span class="pun">;</span></code></pre><p><code>checks</code> 属性值为一个对象包含如下属性：</p><ul>
<li><code>checkedAll</code>：是否已选中所有行；</li>
<li><code>checks</code>：一个数组包含所有被选中的行编号；</li>
</ul></article></section>






























<script src="__ZUI__/lib/datatable/zui.datatable.js"></script>

<script>
function onPageLoad() {
    return false;
}
function afterPageLoad() {
    var now = new Date();
    var start = now.getSeconds(),
        calendars = ['success', 'danger', 'important', 'warning', 'info', 'specail', 'primary'],
        rooms = ['A003', 'A004', 'A010', 'A143', 'B008', 'B098', 'B487', 'B340', 'Z000', 'Z431', 'Z018', 'Z864'],
        peoples = ['奥特曼', '行者孙', '地卜师', '绿巨人', 'Catouse', '路人丙'],
        events = ['进食', '喝水', '交谈', '睡觉', '捶打墙壁', '自言自语', '搬动椅子', '唱歌', '上网', '梦游', '观望天花板'],
        eventsTypes = ['happy', 'sad', ':]'],
        tools = ['桌子', '椅子', '水杯', '枪', '随从'],
        descs = ['没有完成', '这次失败了', '徒劳', '很满意', '禁止再次发生', '也行', '情况不明', '发现未知征兆'];
    var dtDataGenerater = function(rowsCount) {
        var data = {
            cols: [
                {width: 100, text: '#', type: 'number', flex: false, colClass: 'text-center'},
                {sort: 'down', width: 160, text: '时间', type: 'date', flex: false, colClass: ''},
                {width: 80, text: '房间', type: 'string', flex: false, colClass: ''},
                {width: 100, text: '人物', type: 'string', flex: false, colClass: ''},
                {width: 'auto', text: '事件', type: 'string', flex: false, colClass: ''},
                {width: 100, text: '事件类型', type: 'string', flex: true, colClass: 'text-center'},
                {sort: false, width: 200, text: '描述', type: 'string', flex: true, colClass: ''},
                {width: 100, text: '相关人物', type: 'string', flex: true, colClass: ''},
                {width: 100, text: '相关物品', type: 'string', flex: true, colClass: ''},
                {width: 60, text: '评分', type: 'number', flex: false, colClass: 'text-center text-important'},
                {sort: false, width: 'auto', text: '操作', type: 'string', flex: false, colClass: ''},
            ],
            rows: []
        };

        for (var i = 0; i < rowsCount; i++) {
            var row = {checked: Math.random() > 0.9, data: [
                start + i + 101000,
                now.format('yyyy-MM-dd hh:mm:ss'),
                rooms[Math.floor(Math.random()*rooms.length)],
                peoples[Math.floor(Math.random()*peoples.length)],
                events[Math.floor(Math.random()*events.length)],
                eventsTypes[Math.floor(Math.random()*eventsTypes.length)],
                descs[Math.floor(Math.random()*descs.length)],
                peoples[Math.floor(Math.random()*peoples.length)],
                tools[Math.floor(Math.random()*tools.length)],
                Math.floor(Math.random()*100)/10,
                "<a href='###'><i class='icon-ok-sign'></i></a> &nbsp; <a href='###' class='text-danger'><i class='icon-trash'></i></a> "
            ]};
            data.rows.push(row);
            now = new Date(now.getTime() - (Math.random()*1000*60*60));
        };

        return data;
    };

    $('#pageContent .datatable').each(function() {
        var $this = $(this);
        var data = dtDataGenerater($this.data('rows') || 5);
        if($this.attr('id') === 'datatableChangeExample') {
            $this.data('origin-data', data);
        }
        $this.datatable({fixedLeftWidth: '60%', fixedRightWidth: '15%', data: data, scrollContainer: '#pageBody', fixedHeaderOffset: 60});
    });

    var $datatableChangeExample = $('#datatableChangeExample');
    $('#datatableChangeBtn').click(function() {
        var data = $datatableChangeExample.data('origin-data');
        if(data) {
            $.each(data.rows, function(rowIndex, row) {
                row.data[9] = Math.floor(Math.random()*100)/10;
            });
            $datatableChangeExample.datatable('load', data);
        }
    });

    $.doc.stopPageLoading();
}
</script><section><header><h3>数据配置</h3></header><article><h4>增强现有表格</h4><p>直接对一个包含完整头部和数据的普通表格进行增强。DataTable或自动获取所有表头和行上的数据，并配置相关选项。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="com">&lt;!-- 使用Datatable来增强下面的原生表格 --&gt;</span><span class="pln">
</span><span class="tag">&lt;table</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"table datatable"</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="com">&lt;!-- 定义表头 --&gt;</span><span class="pln">
  </span><span class="tag">&lt;thead&gt;</span><span class="pln">
    </span><span class="tag">&lt;tr&gt;</span><span class="pln">
      </span><span class="tag">&lt;th</span><span class="pln"> </span><span class="atn">data-type</span><span class="pun">=</span><span class="atv">"number"</span><span class="pln"> </span><span class="atn">data-width</span><span class="pun">=</span><span class="atv">"80"</span><span class="tag">&gt;</span><span class="pln">#</span><span class="tag">&lt;/th&gt;</span><span class="pln">
      </span><span class="tag">&lt;th</span><span class="pln"> </span><span class="atn">data-type</span><span class="pun">=</span><span class="atv">"date"</span><span class="tag">&gt;</span><span class="pln">时间</span><span class="tag">&lt;/th&gt;</span><span class="pln">
      </span><span class="tag">&lt;th</span><span class="pln"> </span><span class="atn">data-col-class</span><span class="pun">=</span><span class="atv">"text-primary"</span><span class="tag">&gt;</span><span class="pln">名称</span><span class="tag">&lt;/th&gt;</span><span class="pln">
      ...
    </span><span class="tag">&lt;/tr&gt;</span><span class="pln">
  </span><span class="tag">&lt;/thead&gt;</span><span class="pln">
  </span><span class="com">&lt;!-- 定义表格数据，每一个tr对应一个数据，不支持跨行内容 --&gt;</span><span class="pln">
  </span><span class="tag">&lt;tbody&gt;</span><span class="pln">
    </span><span class="tag">&lt;tr&gt;</span><span class="pln">...</span><span class="tag">&lt;/tr&gt;</span><span class="pln">
    </span><span class="tag">&lt;tr&gt;</span><span class="pln">...</span><span class="tag">&lt;/tr&gt;</span><span class="pln">
    ...
  </span><span class="tag">&lt;/tbody&gt;</span><span class="pln">
</span><span class="tag">&lt;/table&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">/* 初始化数据表格 */</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">(</span><span class="pln">options</span><span class="pun">);</span></code></pre><div class="alert alert-primary-inverse">
  <p>使用增强现有表格的方式能够在DataTable组件不可用时也能够正常显示原表格数据。</p>
</div><h4>在启动选项中初始化数据</h4><p>通过设置启动选项的<code>data</code>属性来初始化数据。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="com">&lt;!-- 使用一个div来显示数据表格 --&gt;</span><span class="pln">
</span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"datatable"</span><span class="pln"> </span><span class="atn">data-checkable</span><span class="pun">=</span><span class="atv">"true"</span><span class="pln"> </span><span class="atn">data-sortable</span><span class="pun">=</span><span class="atv">"true"</span><span class="tag">&gt;&lt;/div&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">/* 使用选项选项来初始化数据 */</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">({</span><span class="pln">
    data</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        cols</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
            </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">80</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'#'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'number'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> colClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">'text-center'</span><span class="pun">},</span><span class="pln">
            </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">160</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'时间'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'date'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> sort</span><span class="pun">:</span><span class="pln"> </span><span class="str">'down'</span><span class="pun">},</span><span class="pln">
            </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">80</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'名称'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'string'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"> colClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">''</span><span class="pun">}</span><span class="pln">
        </span><span class="pun">],</span><span class="pln">
        rows</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
            </span><span class="pun">{</span><span class="pln">checked</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> data</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'2016-01-18 11:05:15'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'名称示例1'</span><span class="pun">]},</span><span class="pln">
            </span><span class="pun">{</span><span class="pln">checked</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> data</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'2016-01-20 12:06:16'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'名称示例2'</span><span class="pun">]},</span><span class="pln">
            </span><span class="com">// 更多数据</span><span class="pln">
        </span><span class="pun">]</span><span class="pln">
    </span><span class="pun">},</span><span class="pln">
    </span><span class="com">// 其他选项选项</span><span class="pln">
</span><span class="pun">});</span></code></pre><h4>数据格式</h4><p>一个完整的数据包含列定义和行数据。类定义在javascript代码中为一个数组，在DOM中为<code>thead</code>中的<code>tr</code>标签。行数据在javascript中为一个数组，在DOM中为<code>tbody</code>中的<code>td</code>标签。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pun">{</span><span class="pln">
    </span><span class="com">// 列定义</span><span class="pln">
    cols</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">80</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'#'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'number'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> colClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">'text-center'</span><span class="pun">},</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">160</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'时间'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'date'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> sort</span><span class="pun">:</span><span class="pln"> </span><span class="str">'down'</span><span class="pun">},</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">80</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'名称'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'string'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"> colClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">''</span><span class="pun">}</span><span class="pln">
    </span><span class="pun">],</span><span class="pln">

    </span><span class="com">// 行数据</span><span class="pln">
    rows</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">checked</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> data</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'2016-01-18 11:05:15'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'名称示例1'</span><span class="pun">]},</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">checked</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> data</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'2016-01-20 12:06:16'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'名称示例2'</span><span class="pun">]},</span><span class="pln">
        </span><span class="com">// 更多数据</span><span class="pln">
    </span><span class="pun">]</span><span class="pln">
</span><span class="pun">}</span></code></pre><p>列定义和行数据定义的大部分非数据属性都可以在原始表格中的<code>th</code>和<code>tr</code>标签上以<code>data-*</code>属性的形式定义。</p><h5>列定义</h5><p>每列的可定义属性如下：</p><div class="table-responsive"><table class="table table-bordered">
  <thead>
    <tr>
      <th>属性名称</th>
      <th style="width: 30%">合法值</th>
      <th>说明</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>text</code></td>
      <td>字符串</td>
      <td>定义此列在界面上显示的名称。</td>
    </tr>
    <tr>
      <td><code>width</code></td>
      <td><code>80</code> | <code>'80px'</code> | <code>'80%'</code> | <code>'auto'</code>(默认)</td>
      <td>定义此列的宽度。</td>
    </tr>
    <tr>
      <td><code>flex</code></td>
      <td><code>true</code> | <code>false</code>(默认)</td>
      <td>定义此列在数据表格中显示在为水平可滚动的区域，在此列之前的没有定义<code>flex=true</code>的列则固定在左侧，在此列之后的没有定义<code>flex=true</code>的列会固定在右侧。必须为连续的多列的<code>flex</code>属性定义为<code>true</code>。在DOM中可以为<code>th</code>标签增加CLASS <code>flex-col</code> 实现，等同于<code>flex=true</code>。</td>
    </tr>
    <tr>
      <td><code>cssClass</code></td>
      <td>字符串</td>
      <td>定义数据表格中此列的附加的CSS CLASS值。</td>
    </tr>
    <tr>
      <td><code>type</code></td>
      <td><code>string</code>(默认) | <code>number</code> | <code>date</code></td>
      <td>定义此列数据的类型，目前支持字符串、数字和日期。</td>
    </tr>
    <tr>
      <td><code>sort</code></td>
      <td><em>   <code>true</code>（默认）：支持排序；
</em>   <code>false</code>：不支持排序；
<em>   <code>'down'</code>：默认使用降序排序；
</em>   <code>'up'</code>：默认使用升序排序；</td>
      <td>如果排序启用时定义此列是否可以排序。</td>
    </tr>
    <tr>
      <td><code>ignore</code></td>
      <td><code>true</code> | <code>false</code>(默认)</td>
      <td>是否在构建数据表格时忽略该列，不会在页面显示。</td>
    </tr>
  </tbody>
</table></div><h5>行数据</h5><p>每行数据的可定义属性如下：</p><div class="table-responsive"><table class="table table-bordered">
  <thead>
    <tr>
      <th>属性名称</th>
      <th>合法值</th>
      <th>说明</th>
    </tr>
    <tr>
      <td><code>id</code></td>
      <td>全局唯一字符串</td>
      <td>该行的唯一编号，如果不指定则由程序按顺序生成。</td>
    </tr>
    <tr>
      <td><code>checked</code></td>
      <td><code>true</code> | <code>false</code>(默认)</td>
      <td>此行数据在开始时是否为选中状态。</td>
    </tr>
    <tr>
      <td><code>cssClass</code></td>
      <td>字符串，默认 <code>''</code></td>
      <td>用于添加到生成的行元素 <code>&lt;tr&gt;</code> 上的 CSS 类。</td>
    </tr>
    <tr>
      <td><code>css</code></td>
      <td>字符串，默认 <code>''</code></td>
      <td>用设置 <code>&lt;tr&gt;</code> 上的 <code>[style]</code> 属性，用于自定义行样式。</td>
    </tr>
    <tr>
      <td><code>data</code></td>
      <td>数组</td>
      <td>依次表示此行中每列对应的数据。</td>
    </tr>
  </thead>
</table></div><h4>更新数据</h4><p>当数据表格所依据的原始数据或原始表格发生变更时，需要手动调用<code>load()</code>方法来更新数据表格。<code>load(data)</code>方法允许增加一个参数来使用需要更新的数据。</p><p><code>data</code>参数可以为一个回调函数，此回调函数的第一个参数为原始数据，可以直接在回调函数中修改原始数据。</p><div class="example">
  <div id="datatableChangeExample" class="datatable datatable-update-example sortable show-scroll-slide scrolled-out" data-checkable="true" data-sortable="true"><div class="datatable-head"><div class="datatable-head-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-left"><th data-index="check" class="check-all check-btn"><i class="icon-check-empty"></i></th><th class="datatable-head-cell text-center" data-index="0" data-type="number" style="width: 100px; min-height: 36px; height: 36px;">#</th><th class="datatable-head-cell sort-up" data-index="1" data-type="date" style="width: 160px; min-height: 36px; height: 36px;">时间</th><th class="datatable-head-cell" data-index="2" data-type="string" style="width: 80px; min-height: 36px; height: 36px;">房间</th><th class="datatable-head-cell" data-index="3" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">人物</th><th class="datatable-head-cell" data-index="4" data-type="string" style="width: auto; min-height: 36px; height: 36px;">事件</th></tr></thead></table></div></div><div class="datatable-head-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><thead><tr class="datatable-row datatable-row-flex"><th class="datatable-head-cell text-center" data-index="5" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">事件类型</th><th class="datatable-head-cell sort-disabled" data-index="6" data-type="string" style="width: 200px; min-height: 36px; height: 36px;">描述</th><th class="datatable-head-cell" data-index="7" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关人物</th><th class="datatable-head-cell" data-index="8" data-type="string" style="width: 100px; min-height: 36px; height: 36px;">相关物品</th></tr></thead></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-head-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><thead><tr class="datatable-row datatable-row-right"><th class="datatable-head-cell text-center text-important" data-index="9" data-type="number" style="width: 60px; min-height: 36px; height: 36px;">评分</th><th class="datatable-head-cell sort-disabled" data-index="10" data-type="string" style="width: auto; min-height: 36px; height: 36px;">操作</th></tr></thead></table></div></div></div><div class="datatable-rows"><div class="datatable-rows-span datatable-span fixed-left" style="width: 60%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row active datatable-row-left" data-index="4" data-id="4"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="4" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 36px; height: 36px;">101014</td><td class="datatable-cell" data-row="4" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 36px; height: 36px;">2019-10-29 00:17:34</td><td class="datatable-cell" data-row="4" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 36px; height: 36px;">Z018</td><td class="datatable-cell" data-row="4" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">奥特曼</td><td class="datatable-cell" data-row="4" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;">捶打墙壁</td></tr><tr class="datatable-row datatable-row-left" data-index="3" data-id="3"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="3" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101013</td><td class="datatable-cell" data-row="3" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 00:31:06</td><td class="datatable-cell" data-row="3" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B098</td><td class="datatable-cell" data-row="3" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">行者孙</td><td class="datatable-cell" data-row="3" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">喝水</td></tr><tr class="datatable-row datatable-row-left" data-index="2" data-id="2"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="2" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101012</td><td class="datatable-cell" data-row="2" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 01:09:01</td><td class="datatable-cell" data-row="2" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B487</td><td class="datatable-cell" data-row="2" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">Catouse</td><td class="datatable-cell" data-row="2" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">交谈</td></tr><tr class="datatable-row datatable-row-left" data-index="1" data-id="1"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="1" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101011</td><td class="datatable-cell" data-row="1" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 01:14:27</td><td class="datatable-cell" data-row="1" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">Z018</td><td class="datatable-cell" data-row="1" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="1" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">睡觉</td></tr><tr class="datatable-row datatable-row-left" data-index="0" data-id="0"><td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td><td class="datatable-cell text-center" data-row="0" data-index="0" data-flex="false" data-type="number" title="" style="width: 100px; min-height: 37px; height: 37px;">101010</td><td class="datatable-cell" data-row="0" data-index="1" data-flex="false" data-type="date" title="" style="width: 160px; min-height: 37px; height: 37px;">2019-10-29 01:50:47</td><td class="datatable-cell" data-row="0" data-index="2" data-flex="false" data-type="string" title="" style="width: 80px; min-height: 37px; height: 37px;">B008</td><td class="datatable-cell" data-row="0" data-index="3" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="0" data-index="4" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;">喝水</td></tr></tbody></table></div></div><div class="datatable-rows-span datatable-span flexarea"><div class="datatable-wrapper"><table class="table table-datatable table-hover" style="left: 0px; min-width: 500px;"><tbody><tr class="datatable-row active datatable-row-flex" data-index="4" data-id="4"><td class="datatable-cell text-center" data-row="4" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">sad</td><td class="datatable-cell" data-row="4" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 36px; height: 36px;">情况不明</td><td class="datatable-cell" data-row="4" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">路人丙</td><td class="datatable-cell" data-row="4" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 36px; height: 36px;">水杯</td></tr><tr class="datatable-row datatable-row-flex" data-index="3" data-id="3"><td class="datatable-cell text-center" data-row="3" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">happy</td><td class="datatable-cell" data-row="3" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">徒劳</td><td class="datatable-cell" data-row="3" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">路人丙</td><td class="datatable-cell" data-row="3" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">枪</td></tr><tr class="datatable-row datatable-row-flex" data-index="2" data-id="2"><td class="datatable-cell text-center" data-row="2" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">sad</td><td class="datatable-cell" data-row="2" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">很满意</td><td class="datatable-cell" data-row="2" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">地卜师</td><td class="datatable-cell" data-row="2" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">枪</td></tr><tr class="datatable-row datatable-row-flex" data-index="1" data-id="1"><td class="datatable-cell text-center" data-row="1" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">:]</td><td class="datatable-cell" data-row="1" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">情况不明</td><td class="datatable-cell" data-row="1" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">绿巨人</td><td class="datatable-cell" data-row="1" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">随从</td></tr><tr class="datatable-row datatable-row-flex" data-index="0" data-id="0"><td class="datatable-cell text-center" data-row="0" data-index="5" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">sad</td><td class="datatable-cell" data-row="0" data-index="6" data-flex="false" data-type="string" title="" style="width: 200px; min-height: 37px; height: 37px;">这次失败了</td><td class="datatable-cell" data-row="0" data-index="7" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">行者孙</td><td class="datatable-cell" data-row="0" data-index="8" data-flex="false" data-type="string" title="" style="width: 100px; min-height: 37px; height: 37px;">随从</td></tr></tbody></table><div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div></div></div><div class="datatable-rows-span datatable-span fixed-right" style="width: 15%;"><div class="datatable-wrapper"><table class="table table-datatable table-hover"><tbody><tr class="datatable-row active datatable-row-right" data-index="4" data-id="4"><td class="datatable-cell text-center text-important" data-row="4" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 36px; height: 36px;">9.7</td><td class="datatable-cell" data-row="4" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 36px; height: 36px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="3" data-id="3"><td class="datatable-cell text-center text-important" data-row="3" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">4.4</td><td class="datatable-cell" data-row="3" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="2" data-id="2"><td class="datatable-cell text-center text-important" data-row="2" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">9.6</td><td class="datatable-cell" data-row="2" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="1" data-id="1"><td class="datatable-cell text-center text-important" data-row="1" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">7.3</td><td class="datatable-cell" data-row="1" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr><tr class="datatable-row datatable-row-right" data-index="0" data-id="0"><td class="datatable-cell text-center text-important" data-row="0" data-index="9" data-flex="false" data-type="number" title="" style="width: 60px; min-height: 37px; height: 37px;">5.6</td><td class="datatable-cell" data-row="0" data-index="10" data-flex="false" data-type="string" title="" style="width: auto; min-height: 37px; height: 37px;"><a href="###"><i class="icon-ok-sign"></i></a> &nbsp; <a href="###" class="text-danger"><i class="icon-trash"></i></a> </td></tr></tbody></table></div></div></div><div class="scroll-wrapper"><div class="scroll-slide scroll-pos-in" style="width: 264px; left: 632px;"><div class="bar" style="left: 0px; width: 137px;"></div></div></div></div>
  <button class="btn btn-primary" type="button" id="datatableChangeBtn">更新评分</button>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 更改原始表格数据内容</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'table.datatable-origin'</span><span class="pun">).</span><span class="pln">find</span><span class="pun">(</span><span class="str">'td.data-for-change'</span><span class="pun">).</span><span class="pln">text</span><span class="pun">(</span><span class="str">'更新此单元格'</span><span class="pun">);</span><span class="pln">

</span><span class="com">// 当原始数据发生变更时：</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">(</span><span class="str">'load'</span><span class="pun">);</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 使用data参数更新数据：</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">(</span><span class="str">'load'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    cols</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">80</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'#'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'number'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> colClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">'text-center'</span><span class="pun">},</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">160</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'时间'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'date'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> sort</span><span class="pun">:</span><span class="pln"> </span><span class="str">'down'</span><span class="pun">},</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">80</span><span class="pun">,</span><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'名称'</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'string'</span><span class="pun">,</span><span class="pln"> flex</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"> colClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">''</span><span class="pun">}</span><span class="pln">
    </span><span class="pun">],</span><span class="pln">
    rows</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">checked</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> data</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'2016-01-18 11:09:36'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'新的名称示例1'</span><span class="pun">]},</span><span class="pln">
        </span><span class="pun">{</span><span class="pln">checked</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">,</span><span class="pln"> data</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'2016-01-22 12:06:16'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'新的名称示例2'</span><span class="pun">]},</span><span class="pln">
        </span><span class="com">// 更多数据</span><span class="pln">
    </span><span class="pun">]}</span><span class="pln">
</span><span class="pun">});</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 使用data参数可以使用一个回调函数来修改之前的数据：</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'table.datatable'</span><span class="pun">).</span><span class="pln">datatable</span><span class="pun">(</span><span class="str">'load'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">data</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">// 修改第1行的第3列数据值为'新的名称示例1'</span><span class="pln">
    data</span><span class="pun">.</span><span class="pln">rows</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">data</span><span class="pun">[</span><span class="lit">2</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">'新的名称示例1'</span><span class="pun">;</span><span class="pln">
    </span><span class="com">// 更多的修改...</span><span class="pln">
</span><span class="pun">});</span></code></pre><link href="__ZUI__/lib/datatable/zui.datatable.css" rel="stylesheet"></article></section></div>


</section>
{/block}